home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Apple Guide / Engineering / AGSample / sample source / AGSampleCode.h < prev   
Encoding:
Text File  |  1996-04-15  |  4.7 KB  |  190 lines  |  [TEXT/MPS ]

  1. // AGSampleCode.h
  2. // Copyright 1996, Apple Computer, Inc.
  3. // Date:    23-Jan-96
  4. // Author:    guideWorks, LLC
  5. // Web:        http://www.guideworks.com
  6. // EMail:    powers@guideworks.com
  7. //
  8. // This file contains the headers for the Apple Guide sample code.
  9.  
  10. #ifndef __APPLEGUIDE__
  11.     #include <AppleGuide.h>
  12. #endif
  13. #ifndef __ASREGISTRY__
  14.     #include "ASRegistry.h"
  15. #endif
  16. #ifndef __AGFILE__
  17.     #include "AGFile.h"
  18. #endif
  19.  
  20. // ---------- Constants ---------------------------------------------------
  21.  
  22. #define kAGSTargetAppSignature            'AGS2'
  23. #define kAGSOpenGuideId                    1001
  24. #define kAGSOpenGuideWithSearchId        1002
  25. #define kAGSCheckSelectorDocumentAny    1
  26. #define kAGSCheckSelectorControlFront    2
  27. #define kAGSCheckSelectorControlTrue    3
  28. #define kAGSSearchPhraseID                1001
  29. #define kAGSContextCodeResSpec            'agsd'
  30. #define kAGSAEventClass                    'agse'
  31. #define kAGSAEventOpenNewDocument        'agsw'
  32. #define kAGSAEventCloseDocument            'agsx'
  33. #define kAGSDocSFType                    'AGSD'
  34. #define cAGSASCoachItem                    'agsc'
  35. #define pAGSASCoachRect                    'agsr'
  36.  
  37. // ---------- Data structures ---------------------------------------------
  38.  
  39. // Data structure passed to context check.
  40. // Guide Script:
  41. // <Define Context Check> "IsAnyDocumentOpen", 'agsd', 'AGS2', LONG:1, LONG:0
  42. // <Define Context Check> "IsThisControlFront", 'agsd', 'AGS2', LONG:2, LONG
  43. // <Define Context Check> "IsThisControlTrue", 'agsd', 'AGS2', LONG:3, LONG
  44. typedef struct
  45. {
  46.     long     checkSelector;        // 1, 2, or 3
  47.     long    itemIdentifier;     // The id number for the item of interest.
  48. } InputDataType, *InputDataPtr, **InputDataHan;
  49.  
  50. // ---------- AGSample Prototypes -------------------------------------------------
  51.  
  52. void
  53. AGSInstall();
  54.  
  55. void
  56. AGSRemove();
  57.  
  58. OSErr
  59. AGSInstallCoachHandler();
  60.  
  61. pascal OSErr
  62. AGSCoachReplyProc(Rect* pRect, Ptr name, long refCon);
  63.  
  64. OSErr
  65. AGSRemoveCoachHandler();
  66.  
  67. OSErr
  68. AGSInstallContextHandler();
  69.  
  70. OSErr
  71. AGSRemoveContextHandler();
  72.  
  73. pascal OSErr
  74. AGSContextReplyProc(Ptr pInputData, Size inputDataSize,
  75.                                 Ptr *ppOutputData, Size *pOutputDataSize, 
  76.                                 AGAppInfoHdl hAppInfo);
  77.  
  78. OSErr
  79. AGSInstallAEHandler();
  80.  
  81. OSErr
  82. AGSRemoveAEHandler();
  83.  
  84. pascal OSErr
  85. AGSHandleAEvents(AppleEvent* theAppleEvent,
  86.                                 AppleEvent* theReply, long refCon);
  87.  
  88. OSErr
  89. AGSOpenGuide();
  90.  
  91. OSErr
  92. AGSOpenGuideWithSearch(short searchPhraseIndex);
  93.  
  94. OSErr
  95. AGSGetAppFSSpec(FSSpec* pFileSpec);
  96.  
  97.  
  98. OSErr
  99. AGSInstallASCoachHandlers();
  100.  
  101. OSErr
  102. AGSRemoveASCoachHandlers();
  103.  
  104. pascal OSErr
  105. AGSHandleGetData(AppleEvent* theAppleEvent,
  106.                             AppleEvent* reply,
  107.                              long refCon);
  108.  
  109. OSErr
  110. AGSGetDataItemCoachRect(AEDesc* token, AEDesc* pResult);
  111.  
  112. pascal OSErr
  113. AGSCoachItemAccessor(    DescType    desiredClass,
  114.                           AEDesc*        containerToken,
  115.                         DescType    containerClass, 
  116.                         DescType    keyForm,
  117.                         AEDesc*        keyData,
  118.                         AEDesc*        resultToken,
  119.                         long         refCon);
  120.  
  121. pascal OSErr
  122. AGSCoachItemPropertyAccessor(    DescType    desiredClass,
  123.                                   AEDesc*        containerToken,
  124.                                 DescType    containerClass, 
  125.                                 DescType    keyForm,
  126.                                 AEDesc*        keyData,
  127.                                 AEDesc*        resultToken,
  128.                                 long         refCon);
  129.  
  130. OSErr
  131. AGSIsMissingParams(AppleEvent*  theAppleEvent);
  132.  
  133. OSErr
  134. AGSDescToLong(const  AEDesc* desc, long* pLongValue);
  135.  
  136. OSErr
  137. AGSDescToPString(const AEDesc* desc, StringPtr pStr, short maxLength);
  138.  
  139. // ---------- Apps-To-Go Prototypes -------------------------------------------------
  140.  
  141. // constants for Apps-To-Go
  142. struct FileRec;
  143. typedef struct FileRec *FileRecPtr, **FileRecHndl;
  144. void
  145. #define kMinHeap    64 * 1024        /* Needs at least 64k of heap space. */
  146. #define kMinSpace    64 * 1024        /* Needs this much after calling PurgeSpace. */
  147. // Apps-To-Go calls to Apps-To-Go (overrides)
  148. ContentClick(WindowPtr window, EventRecord *event, Boolean firstClick);
  149. // AGSample calls to Apps-To-Go
  150. long
  151. c2dec(char *cptr, short *charsUsed);
  152. WindowPtr
  153. GetNextDocumentWindow(WindowPtr window, OSType sftype);
  154. Rect
  155. GetWindowContentRect(WindowPtr window);
  156. short
  157. CNum2Ctl(WindowPtr window, short ctlNum, ControlHandle *ctl);
  158. short
  159. GetWindowCount(Boolean includeDAs, Boolean includeDLOGs, Boolean includeInvisibles);
  160. OSErr
  161. NewDocument(FileRecHndl *returnHndl, OSType sftype, Boolean incTitleNum);
  162. OSErr
  163. DoNewWindow(FileRecHndl frHndl, WindowPtr *retWindow, WindowPtr relatedWindow, WindowPtr behind);
  164. Boolean
  165. DisposeOneWindow(WindowPtr window, short saveMode);
  166. short
  167. IsCtlEvent(WindowPtr window, EventRecord *event, ControlHandle *ctl, short *action);
  168. // main calls to Apps-To-Go
  169. void
  170. InitATGLIB(void);
  171. void
  172. Initialize(short moreMasters, long minHeap, long minSpace, ProcPtr init1, ProcPtr init2);
  173. CursPtr
  174. DoSetResCursor(short crsrID);
  175. OSErr
  176. InitRequiredAppleEvents(void);
  177. OSErr
  178. DoOpenApplication(void);
  179. OSErr
  180. GetWindowFormats(void);
  181. OSErr
  182. ReadPreferences(OSType prefType, OSType prefCreator, short prefLocID);
  183. OSErr
  184. OpenRuntimeOnlyAutoNewWindows(void);
  185. void
  186. DoAdjustMenus(void);
  187. void
  188. EventLoop(void);
  189. OSErr
  190. WritePreferences(void);